﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Inovout.Models;

namespace Inovout.Service.Models.Tests
{

    public class Order : DataObject
    {
        private ISet<OrderItem> orderItems;
        public ISet<OrderItem> OrderItems
        {
            get { return orderItems; }
        }
        public Order()
        {
            orderItems = new DataObjectSet<OrderItem>((orderItem) => { orderItem.Order = this; });
        }
    }
    public class OrderItem : DataObject
    {
        public Order Order { get; set; }
    }

    public interface IPersonSummary
    {
        string Name { get; }
        int Age { get; }
    }
    public interface IPerson
    {
        string Name { get; set; }
        DateTime Birthday { get; set; }
    }
    public partial class Person : IPerson, IPersonSummary
    {
        public int Age
        {
            get
            {
                return (DateTime.Now.Year - Birthday.Year)
                    + ((DateTime.Now 
                        >= new DateTime(DateTime.Now.Year, Birthday.Month, Birthday.Day)) 
                            ? 1 : 0);
            }
        }
    }
    public partial class Person : DataObject
    {
        public string Name { get; set; }
        public DateTime Birthday { get; set; }
    }

    public class DataObjectSetTestCase
    {
    }
}
